<%@page import="java.lang.reflect.Array"%>
<%@page import="cn.chinaiptv.utils.PageUtils"%>
<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
<%@page import="cn.chinaiptv.bean.RecordBean"%>
<%@page import="java.util.ArrayList"%>
<%@page import="cn.chinaiptv.utils.RecordUtils"%>
<%@ page language="java" import="cn.chinaiptv.*" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>爱上电视C1系统</title>
<link rel="stylesheet" href="css/logView.css">
<link rel="stylesheet" href="css/page.css">
<script src="js/jquery.js"></script>
<script src="js/layer/layer.js"></script>
<script src="js/c1.js"></script>

</head>

<body>
	<div class="header">
		<div class="header_one">
			<p>欢迎您：您当前所在的位置：爱上电视C1系统</p>
		</div>
		<div class="header_two">
			<ul id="tabs_one">
				<li class="tab-nav l"><a href="update.jsp">模板下发</a>
				<li class="tab-nav l"><a href="delete.jsp">文件删除</a>
				<li class="tab-nav-action l"><a href="record.jsp?page=1">日志</a>
				<li class="tab-nav r"><a
					href="${pageContext.request.contextPath}/LogoutServlet"><span><img
							src="img/loginout.jpg" alt="loginout" class="login-out">退出</span></a><>
				
				<li class="tab-nav r"
					style="${sessionScope.user.username=='adminstrator'?'':'visibility:hidden'} ;">
					<a href="${pageContext.request.contextPath}/editPassword.jsp"><span><img
							src="img/modify.jpg" alt="modify" class="modify-message">修改密码</span></a>
					<>
			</ul>
		</div>

	</div>
	<div class="log_main">
		<div class="main_one">
			<p>爱上电视C1系统</p>
		</div>
		<div>
			<p class="log-view">
				<span class="module-icon">日志</span>
			</p>
			<ul class="log-tab">
				<li class="log-tab-view"><span>时间</span> <span>下发平台</span> <span>下发状态</span>
					<span>操作</span> <span>更新/删除文件</span> <span class="special">工单地址</span>
				</li>
				<%
					String pageStr = request.getParameter("page");//用request得到 
					int page1 = 1;
					int pagesize = 10;
					if (pageStr != null && pageStr != "")
						page1 = Integer.parseInt(pageStr);
					int pagecount = PageUtils.getpageCoun(pagesize);
					ArrayList<RecordBean> allBeans = RecordUtils.getRecords();
					ArrayList<RecordBean> beans = RecordUtils.getNextPage(page1,
							pagesize);
					out.print("<li >");
					if (beans != null && beans.size() >= 1) {
						for (RecordBean bean : beans) {
							String platform = "";
							if (bean.getPlatform().equals("zte")) {
								platform = "中兴";
							} else {
								platform = "华为";
							}
							String weeksheetUrl = bean.getWorksheedURl();
							String[] arr = weeksheetUrl.split("/");
							String wookSheetName = "";
							if (arr.length != 0) {
								wookSheetName = arr[arr.length - 1];
							}
							String status = "";
							if (bean.getStatus().equals("请求成功")) {
								status = "<span>" + bean.getStatus() + "</span>";
							} else {
								status = "<span style='color: red'>" + bean.getStatus()
										+ "</span>";
							}
							String opertaion = "";
							if (bean.getOperation().equals("filedelete")) {
								opertaion = "删除";
							} else {
								opertaion = "更新";
							}
							out.print("	<span>" + bean.getTime() + "</span><span>"
									+ platform + "</span>" + status + "<span>"
									+ opertaion + "</span><span>" + bean.getFileName()
									+ "</span><span class='special'>" + wookSheetName
									+ "</span>");
						}
						out.print("</li>");
					}
					if (pagecount > 1) {
						String str = PageUtils.dspPage("record.jsp", page1, pagesize,
								allBeans.size(), pagecount);
						out.print("<div id='pagelist' " + str + "</div>");
					}
				%>

			</ul>

		</div>

	</div>

	</div>
	<div class="footer">
		<p>Copyrighto 2015,China IPTV Co.,Ltd.ALLRights Reserved</p>
	</div>

</body>
</html>